<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!--
 ~ Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 ~
 ~ WSO2 Inc. licenses this file to you under the Apache License,
 ~ Version 2.0 (the "License"); you may not use this file except
 ~ in compliance with the License.
 ~ You may obtain a copy of the License at
 ~
 ~    http://www.apache.org/licenses/LICENSE-2.0
 ~
 ~ Unless required by applicable law or agreed to in writing,
 ~ software distributed under the License is distributed on an
 ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 ~ KIND, either express or implied.  See the License for the
 ~ specific language governing permissions and limitations
 ~ under the License.
 -->
<html>
<head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"/>
    <title>Mediation Sequences - User Guide</title>
    <link href="../../admin/css/documentation.css" rel="stylesheet" type="text/css" media="all"/>
</head>

<body>
<h1>Mediation Sequences</h1>

Use the <span style="font-style: italic; font-weight: bold;">Mediation
Sequences</span> page to add new sequences or edit existing sequences.

As shown in Figure,1 the sequence management section displays a list of
existing sequences. Defined sequences tab shows sequences saved in synapse configuration. Dynamic sequences tab shows
sequences saved in registry.

<div class="image">
<img src="images/sequence-list.png" alt=""/>

<p>Figure 1: Mediation sequence management</p>
</div>
In the navigator, under Manage/Service Bus, click <span
style="font-weight: bold;">Sequences</span>. The <span
style="font-weight: bold; font-style: italic;">Mediation Sequences</span>
page appears.

<ul>
  <li>Enable Statistics
    <ul>
      <li>Click <span style="font-weight: bold;">Enable Statistics</span> to
        gather information relating to a particular sequence.</li>
    </ul>
  </li>
  <li>Enable Tracing
    <ul>
      <li>Click <span style="font-weight: bold;">Enable Tracing</span> to
        turn on all trace messages for the corresponding sequence</li>
    </ul>
  </li>
</ul>
The above options are turned off by default because they cause a severe
performance degradation. Use these options only in a situation where you have
to debug a particular problem. Dynamic sequences does not support Enable Statistics and Enable Tracing.


<ul>
  <li>Edit
    <ul>
      <li>Click <span style="font-weight: bold;">Edit</span> to open the
        sequence in the design view for editing purposes.</li>
    </ul>
  </li>
  <li>Delete
    <ul>
      <li>Click <span style="font-weight: bold;">Delete</span> to remove a
        particular sequence from the system.</li>
    </ul>
  </li>
</ul>

<h3>Adding a Sequence</h3>
<ol>
  <li style="color: black;">On the <span
    style="font-weight: bold; font-style: italic;">Mediation Sequences</span>
    page, click <span style="font-weight: bold;">Add Sequence</span>. The
    <span style="font-style: italic; font-weight: bold;">Design
    Sequence</span> page appears.</li>
  <li style="color: black;">Enter a sequence name.</li>
  <li><span style="color: black;">Click </span><span
    style="font-weight: bold; color: black;">Add Child</span><span
    style="color: black;">, and select the required nodes for your sequence.
    </span>

    Each option is described under <a href="#fielddescriptions">Field
    descriptions</a></li>
</ol>



<div class="image">
<img src="images/add-sequence.png" alt=""/>

<p>Figure 2: Add sequence design view</p>
</div>

<h3>Adding a dynamic sequence</h3>
<ol>
    <li>On the design sequence page click on the <span style="font-weight: bold;">Save As</span> button.
    You'll be displayed <span style="font-weight: bold;">Save As Synapse Registry Entry</span> section.</li>
    <li>Select <span style="font-weight: bold;">Governance Registry</span> or <span
            style="font-weight: bold;">Configuration Registry</span></li>
    <li>Provide the key of the dynamic resource. This key will act as the path where the resource will be
    added in Registry.</li>
</ol>
<div class="image">
    <img src="images/dynamic-seq.png" alt=""/>
    <p>Figure 2.1: Add a dynamic sequence</p>
</div>

<p>The saved dynamic sequence will be displayed as follows</p>
<div>
    <img src="images/saved-dyn-seq.png" alt=""/>
    <p>Figure 2.2: Saved dynamic sequence</p>
</div>

<h3>Editing a sequence</h3>
<ol>
    <li>On the
        <span style="font-weight: bold; font-style: italic;">Mediation
            Sequences
        </span>
        page, click
        <span
                style="font-weight: bold;">Edit.
        </span>
        The
        <span
                style="font-style: italic; font-weight: bold;">Design Sequence
        </span>
        page appears, displaying the selected sequence.

        <div class="image">
            <img src="images/edit-sequence.png" alt=""/>

            <p>Figure 3: Editing a sequence</p>
        </div>
    </li>
    <li>
        <span style="color: black;">Click on the node you want edit. The
            properties for that node will be displayed below.
        </span>
        <div class="image">
            <img src="images/node-editor.png" alt=""/>

            <p>Figure 4: Editing node specific properties</p>
        </div>
    </li>
</ol>

<ul>
  <li>You can edit the node specific attributes displayed in the Design
  view.</li>
  <li>You can add a sibling node, in the Design view..</li>
  <li>You can add only siblings to some nodes, while you can also add a child
    node to others.</li>
  <li>You can move the selected node up or down using the arrow icons.</li>
  <li>You can also delete the node.</li>
</ul>



<p>Click <span style="font-weight: bold;">switch to source view</span> to
view the XML of the particular sequence. If you're familiar with the Synapse
configuration language you can edit the XML directly.</p>



<div class="image">
<img src="images/sequence-source.png" alt="Sequence source view"/>

<p>Figure 5: Source view of the sequence editor </p>
</div>



<h3><a name="fielddescriptions"/>Field Descriptions</h3>

<table style="text-align: left; width: 100%;" border="1" cellpadding="2"
cellspacing="2">
  <tbody>
    <tr>
      <td colspan="1" rowspan="1">Core</td>
      <td colspan="1" rowspan="1"/>
    </tr>
    <tr>
      <td colspan="1" rowspan="1" width="300">
        <div style="margin-left: 40px;">
        Drop</div>
      </td>
      <td colspan="1" rowspan="1">Drops a particular message</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Sequence</div>
      </td>
      <td colspan="1" rowspan="1">Defines a reference to an already defined
        sequence</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Send</div>
      </td>
      <td colspan="1" rowspan="1">Sends the message to an endpoint defined
        inside the endpoint property. If an endpoint is not defined, sends
        the message to the address specified in the "to" header.</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Log</div>
      </td>
      <td colspan="1" rowspan="1">Logs the received messages</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Property</div>
      </td>
      <td colspan="1" rowspan="1">Handles message and transport level
        properties</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Event</div>
      </td>
      <td colspan="1" rowspan="1">Send event notifications to an event source</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">Extension</td>
      <td colspan="1" rowspan="1"/>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Script</div>
      </td>
      <td colspan="1" rowspan="1">Defines a script in a scripting language
        and diverts control to that particular script</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Class</div>
      </td>
      <td colspan="1" rowspan="1">Defines a reference to the Java class which
        implements the Mediator interface. Control will be passed to this
        class.</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Spring</div>
      </td>
      <td colspan="1" rowspan="1">Defines a reference to a Spring bean which
        will take control</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Command</div>
      </td>
      <td colspan="1" rowspan="1">Holds a reference to a class with only an
        execute method without having to implement the Mediator
      interface</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">Filter</td>
      <td colspan="1" rowspan="1"/>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Switch</div>
      </td>
      <td colspan="1" rowspan="1">Filters a message like in a switch case
        statement according to specified conditions</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Filter</div>
      </td>
      <td colspan="1" rowspan="1">Filters a message like in an If Else
      clause</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Out</div>
      </td>
      <td colspan="1" rowspan="1">Filters the outgoing messages</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Validate</div>
      </td>
      <td colspan="1" rowspan="1">Validates a particular message over
      schema</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        In</div>
      </td>
      <td colspan="1" rowspan="1">Filters the incoming messages</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Router</div>
      </td>
      <td colspan="1" rowspan="1">Route messages based on XPath filtering</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">Advanced</td>
      <td colspan="1" rowspan="1"/>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        RMSequence</div>
      </td>
      <td colspan="1" rowspan="1">Used with RM to create a message
      sequence</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        DBReport</div>
      </td>
      <td colspan="1" rowspan="1">Writes data to a database</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Aggregate</div>
      </td>
      <td colspan="1" rowspan="1">Used for batch processing where a
        collection of messages gets treated as one</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Clone</div>
      </td>
      <td colspan="1" rowspan="1">Makes copies of a message</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Throttle</div>
      </td>
      <td colspan="1" rowspan="1">Throttle messages</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Callout</div>
      </td>
      <td colspan="1" rowspan="1">Used to do a blocking call to a particular
        service</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Iterate</div>
      </td>
      <td colspan="1" rowspan="1">Iterates over a set of message elements</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        DBLookup</div>
      </td>
      <td colspan="1" rowspan="1">Reads data from a database and gets it into
        a message</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Cache</div>
      </td>
      <td colspan="1" rowspan="1">Caches response messages</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Transaction</div>
      </td>
      <td colspan="1" rowspan="1">Executes a set of mediators transactionally</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Rule</div>
      </td>
      <td colspan="1" rowspan="1">Rule based message mediation</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Entitlement</div>
      </td>
      <td colspan="1" rowspan="1">Fine grained authentication</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">Transform</td>
      <td colspan="1" rowspan="1"/>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Fault</div>
      </td>
      <td colspan="1" rowspan="1">Creates a SOAP fault</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        Header</div>
      </td>
      <td colspan="1" rowspan="1">Processes message headers</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        XSLT</div>
      </td>
      <td colspan="1" rowspan="1">Transforms a particular message</td>
    </tr>
    <tr>
      <td colspan="1" rowspan="1">
        <div style="margin-left: 40px;">
        XQuery</div>
      </td>
      <td colspan="1" rowspan="1">Transforms a message using XQuery</td>
    </tr>
  </tbody>
</table>
<p>For <a href="http://wso2.org/library/esb">more information</a> please refer to the WSO2 library</p>
</body>
</html>
